﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "IGraphicsCurve3d.h"

namespace gcmp
{
    class IArc3d;

    /// \brief 圆弧图形节点
    GCMP_DEPRECATED_CLASS(2023/11/01) class GCMP_GRAPHICS_NODE_INTERFACE_EXPORT IGraphicsArc : public IGraphicsCurve3d
    {
        DEFINE_CAST_DERIVED(IGraphicsArc, IGraphicsCurve3d)

    public:
        /// \brief 析构器
        virtual ~IGraphicsArc();

    public:
        /// \brief 给节点设置标签
        /// \param tag 设置在节点上的标签
        GCMP_DEPRECATED_API(2023/11/01) virtual void SetTag(const Guid& tag) = 0;

        /// \brief 获得圆弧圆心
        /// \return 圆弧圆心坐标
        GCMP_DEPRECATED_API(2023/11/01) virtual Vector3d GetCenter() const = 0;

        /// \brief 获得圆弧半径
        /// \return 圆弧半径
        GCMP_DEPRECATED_API(2023/11/01) virtual double GetRadius() const = 0;

        /// \brief 设置圆弧半径
        /// \param dRadius 圆弧半径
        /// \return 无    
        GCMP_DEPRECATED_API(2023/11/01) virtual bool SetRadius(double dRadius) = 0;

        /// \brief 获得是否逆时针
        /// \return true-是；false-否
        GCMP_DEPRECATED_API(2023/11/01) virtual bool IsAntiClockwise() const = 0;

        /// \brief 获得圆弧起始角度
        /// \return 圆弧起始角度
        GCMP_DEPRECATED_API(2023/11/01) virtual double GetStartAngle() const = 0;

        /// \brief 获得圆弧终止角度
        /// \return 圆弧终止角度
        GCMP_DEPRECATED_API(2023/11/01) virtual double GetEndAngle() const = 0;

        /// \brief 获得圆弧的法向
        /// \return 圆弧的法向
        GCMP_DEPRECATED_API(2023/11/01) virtual Vector3d GetNormal() const = 0;

        /// \brief 获得圆弧的所在坐标系的X轴
        /// \return 圆弧的所在坐标系的X轴
        GCMP_DEPRECATED_API(2023/11/01) virtual Vector3d GetDirectionX() const = 0;

        /// \brief 获得圆弧的所在坐标系的Y轴
        /// \return 圆弧的所在坐标系的Y轴
        GCMP_DEPRECATED_API(2023/11/01) virtual Vector3d GetDirectionY() const = 0;

    public:
        /// \brief 获取圆弧
        /// \return 圆弧
        GCMP_DEPRECATED_API(2023/11/01) virtual const IArc3d* GetGmArc3d() const = 0;

        /// \brief 设置圆弧圆心
        /// \param centerPt 圆弧圆心
        /// \return true-设置成功；false-设置失败    
        GCMP_DEPRECATED_API(2023/11/01) virtual bool SetCenter(const Vector3d& centerPt) = 0;

        /// \brief 获取曲线外一点到曲线的最近的垂点
        /// \param givenpoint 曲线外一点
        /// \param referencePoint 如果有多个垂点，取离点givenpoint最近的垂点
        /// \return 1-失败；0-成功 
        /// TODO-XY：返回值不合理，改成true和false？
        GCMP_DEPRECATED_API(2023/11/01) virtual int GetPerpendicularPoint(const Vector3d& givenpoint, const Vector3d& referencePoint, Vector3d& perpPoint) const = 0;

        /// \brief 根据三点设置圆弧
        /// \param startPoint 圆弧起点
        /// \param endPoint   圆弧终点
        /// \param referencePoint   参考点
        /// \return 无    
        GCMP_DEPRECATED_API(2023/11/01) virtual void Set(const Vector3d& startPoint, const Vector3d& endPoint, const Vector3d& referencePoint) = 0;

        /// \brief 根据圆心，半径，起始弧度，终止弧度，顺时方向设置圆弧
        /// \param centerPoint 圆弧圆心
        /// \param directionX 坐标系X轴单位向量
        /// \param directionY 坐标系Y轴单位向量
        /// \param dRadius 圆弧半径
        /// \param dStartAngle 起始弧度
        /// \param dEndAngle 终止弧度
        /// \param bAntiClockwise 圆弧方向，true：逆时，false：顺时
        /// \return 无    
        GCMP_DEPRECATED_API(2023/11/01) virtual void Set(const Vector3d& centerPoint, const Vector3d& directionX, const Vector3d& directionY,
            double dRadius, double dStartAngle, double dEndAngle, bool bAntiClockwise) = 0;

    public:
        /// \brief 根据圆弧构造圆弧图形节点
        /// \param opIArc3d 圆弧
        /// \return 构造的圆弧图形节点
        GCMP_DEPRECATED_API(2023/11/01) static OwnerPtr<IGraphicsArc> Create(OwnerPtr<IArc3d> opIArc3d);

        /// \brief 根据圆心，X轴，Y轴，起点、终点，顺时方向构造圆弧图形节点
        /// \param centerPoint 圆弧圆心
        /// \param directionX 坐标系X轴单位向量
        /// \param directionY 坐标系Y轴单位向量
        /// \param startPoint 圆弧起点
        /// \param endPoint 圆弧终点
        /// \param bAntiClockwise 圆弧方向，true：逆时，false：顺时
        /// \return 构造的圆弧图形节点
        GCMP_DEPRECATED_API(2023/11/01) static OwnerPtr<IGraphicsArc> Create(const Vector3d& centerPoint, const Vector3d& directionX, const Vector3d& directionY,
            const Vector3d& startPoint, const Vector3d& endPoint, bool bAntiClockwise);

        /// \brief 据圆心、起点、终点和顺逆时针构造圆弧图形节点
        ///
        /// 使用者需保证圆心、起点、终点不共线
        /// \param centerPoint 圆弧圆心
        /// \param startPoint 圆弧起点
        /// \param endPoint 圆弧终点
        /// \param bAntiClockwise 圆弧方向，true：逆时，false：顺时
        /// \return 构造的圆弧图形节点
        GCMP_DEPRECATED_API(2023/11/01) static OwnerPtr<IGraphicsArc> Create(const Vector3d& centerPoint, const Vector3d& startPoint, const Vector3d& endPoint, bool bAntiClockwise);

        /// \brief 据圆心、起点、终点和顺逆时针构造圆弧图形节点
        ///
        /// 使用者需保证圆心、起点、终点不共线
        /// \param centerPoint 圆弧圆心
        /// \param startPoint 圆弧起点
        /// \param endPoint 圆弧终点
        /// \param bAntiClockwise 圆弧方向，true：逆时，false：顺时
        /// \return 构造的圆弧图形节点
        GCMP_DEPRECATED_API(2023/11/01) static OwnerPtr<IGraphicsArc> CreateByCenterAndRadius(const Vector3d& centerPoint, const Vector3d& directionX, const Vector3d& directionY,
            double dRadius, double dStartAngle, double dEndAngle, bool bAntiClockwise);

        /// \brief 根据三点构造圆弧图形节点
        /// \param startPoint 圆弧起点
        /// \param endPoint 圆弧终点
        /// \param referencePoint 参考点
        /// \return 构造的圆弧图形节点
        GCMP_DEPRECATED_API(2023/11/01) static OwnerPtr<IGraphicsArc> CreateByThreePoints(const Vector3d& startPoint, const Vector3d& endPoint, const Vector3d& referencePoint);
    };
}




